< previous page page_313 next page >

Page 313
Arranging Child Forms
If your application can have multiple child forms open, you may want to enable the user to arrange them from the Window menu, like you can do in Word or Excel. Visual Basic provides four options: Tile Horizontal, Tile Vertical, Cascade, and Arrange Icons.
MDIForm has an Arrange method you can pass a constant to that tells the open child forms how to arrange themselves. The following code shows each of these options, which you can attach to the menu items under the Window menu:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub mnuWArrange_Click()
   Me.Arrange vbArrangeIcons
End Sub

Private Sub mnuWCascade_Click()
   Me.Arrange vbCascade
End Sub

Private Sub mnuWHorizontal_Click()
   Me.Arrange vbTileHorizontal
End Sub

Private Sub mnuWVertical_Click()
   Me.Arrange vbTileVertical
End Sub
To test this behavior, lets create a blank form that does nothing but allows you to resize it.
EXERCISE
Arranging Child Forms
1. Add a form to your project.
2. Set the Name property to frmChild.
3. Set the Caption property to Child Form.
4. Set the MDIChild property to True.
5. Add a menu to the main MDI form with the Caption property set to &New Child.

 
< previous page page_313 next page >

If you like this book, buy it!